<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input
      id="input"
      type="text"
      data-age="20"
      data-name="jack"
      data-gender="boy"
      data-min-height="100"
    />
    <script>
      // 同步
      const input = document.getElementById("input");
      setTimeout(() => {
        console.log(input.getAttribute("data-age"));
        console.log(input.dataset);
        console.log(input.dataset.age);
        console.log(input.dataset.name);
        console.log(input.dataset.gender);
        console.log(input.dataset.minHeight);
        input.dataset.maxAge = 100;
      });
    </script>
  </body>
</html>
